<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <!-- <el-form-item label="序列" prop="sequence">
        <el-input
          v-model="queryParams.sequence"
          placeholder="请输入序列"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Priority" prop="priority">
        <el-input
          v-model="queryParams.priority"
          placeholder="请输入Priority"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="创建日期">
        <el-date-picker
          v-model="daterangeCreateDate"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item> -->
      <!-- <el-form-item label="日期">
        <el-date-picker
          v-model="daterangeDate"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item> -->
      <!-- <el-form-item label="公司id" prop="companyId">
        <el-input
          v-model="queryParams.companyId"
          placeholder="请输入公司id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="期望日期">
        <el-date-picker
          v-model="daterangeDateExpected"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item> -->
      <el-form-item label="产品id" prop="productId">
        <el-input v-model="queryParams.productId" placeholder="请输入产品id" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="订单数量" prop="orderedQty">
        <el-input v-model="queryParams.orderedQty" placeholder="请输入订单数量" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="库存数量" prop="productQty">
        <el-input v-model="queryParams.productQty" placeholder="请输入库存数量" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!-- <el-form-item label="Initial Demand" prop="productUomQty">
        <el-input
          v-model="queryParams.productUomQty"
          placeholder="请输入Initial Demand"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="单位" prop="productUom">
        <el-input
          v-model="queryParams.productUom"
          placeholder="请输入单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="未知" prop="productPackaging">
        <el-input
          v-model="queryParams.productPackaging"
          placeholder="请输入未知"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="位置" prop="locationId">
        <el-input
          v-model="queryParams.locationId"
          placeholder="请输入位置"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Destination Location" prop="locationDestId">
        <el-input
          v-model="queryParams.locationDestId"
          placeholder="请输入Destination Location"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="合作伙伴id" prop="partnerId">
        <el-input
          v-model="queryParams.partnerId"
          placeholder="请输入合作伙伴id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="库存收发id" prop="pickingId">
        <el-input
          v-model="queryParams.pickingId"
          placeholder="请输入库存收发id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="备注" prop="note">
        <el-input
          v-model="queryParams.note"
          placeholder="请输入备注"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="状态" prop="state">
        <el-input
          v-model="queryParams.state"
          placeholder="请输入状态"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="单价" prop="priceUnit">
        <el-input
          v-model="queryParams.priceUnit"
          placeholder="请输入单价"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="数据源" prop="origin">
        <el-input
          v-model="queryParams.origin"
          placeholder="请输入数据源"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Supply Method" prop="procureMethod">
        <el-input
          v-model="queryParams.procureMethod"
          placeholder="请输入Supply Method"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Scrapped" prop="scrapped">
        <el-input
          v-model="queryParams.scrapped"
          placeholder="请输入Scrapped"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="组别" prop="groupId">
        <el-input
          v-model="queryParams.groupId"
          placeholder="请输入组别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="规则" prop="ruleId">
        <el-input
          v-model="queryParams.ruleId"
          placeholder="请输入规则"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Push Rule" prop="pushRuleId">
        <el-input
          v-model="queryParams.pushRuleId"
          placeholder="请输入Push Rule"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Propagate cancel and split" prop="propagate">
        <el-input
          v-model="queryParams.propagate"
          placeholder="请输入Propagate cancel and split"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="库存收发类别" prop="pickingTypeId">
        <el-input
          v-model="queryParams.pickingTypeId"
          placeholder="请输入库存收发类别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Inventory" prop="inventoryId">
        <el-input
          v-model="queryParams.inventoryId"
          placeholder="请输入Inventory"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Origin return move" prop="originReturnedMoveId">
        <el-input
          v-model="queryParams.originReturnedMoveId"
          placeholder="请输入Origin return move"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Owner " prop="restrictPartnerId">
        <el-input
          v-model="queryParams.restrictPartnerId"
          placeholder="请输入Owner "
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item label="海内外" prop="warehouseId">
        <el-input v-model="queryParams.warehouseId" placeholder="请输入海内外" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!-- <el-form-item label="Whether the move was added after the picking's confirmation" prop="additional">
        <el-input
          v-model="queryParams.additional"
          placeholder="请输入Whether the move was added after the picking's confirmation"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Reference" prop="reference">
        <el-input
          v-model="queryParams.reference"
          placeholder="请输入Reference"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="创建者" prop="createUid">
        <el-input
          v-model="queryParams.createUid"
          placeholder="请输入创建者"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="更新者" prop="writeUid">
        <el-input
          v-model="queryParams.writeUid"
          placeholder="请输入更新者"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="更新日期">
        <el-date-picker
          v-model="daterangeWriteDate"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item> -->
      <!-- <el-form-item label="Created Production Order" prop="createdProductionId">
        <el-input
          v-model="queryParams.createdProductionId"
          placeholder="请输入Created Production Order"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Production Order for finished products" prop="productionId">
        <el-input
          v-model="queryParams.productionId"
          placeholder="请输入Production Order for finished products"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Production Order for raw materials" prop="rawMaterialProductionId">
        <el-input
          v-model="queryParams.rawMaterialProductionId"
          placeholder="请输入Production Order for raw materials"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Disassembly Order" prop="unbuildId">
        <el-input
          v-model="queryParams.unbuildId"
          placeholder="请输入Disassembly Order"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="Consumed Disassembly Order" prop="consumeUnbuildId">
        <el-input
          v-model="queryParams.consumeUnbuildId"
          placeholder="请输入Consumed Disassembly Order"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="Operation To Consume" prop="operationId">
        <el-input
          v-model="queryParams.operationId"
          placeholder="请输入Operation To Consume"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="工作订单id" prop="workorderId">
        <el-input
          v-model="queryParams.workorderId"
          placeholder="请输入工作订单id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="订单行id" prop="bomLineId">
        <el-input
          v-model="queryParams.bomLineId"
          placeholder="请输入订单行id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="Unit Factor" prop="unitFactor">
        <el-input
          v-model="queryParams.unitFactor"
          placeholder="请输入Unit Factor"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="是否完成" prop="isDone">
        <el-input
          v-model="queryParams.isDone"
          placeholder="请输入是否完成"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="To Refund (update SO/PO)" prop="toRefund">
        <el-input
          v-model="queryParams.toRefund"
          placeholder="请输入To Refund (update SO/PO)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="value" prop="value">
        <el-input
          v-model="queryParams.value"
          placeholder="请输入value"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="Remaining Qty" prop="remainingQty">
        <el-input
          v-model="queryParams.remainingQty"
          placeholder="请输入Remaining Qty"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="Remaining Value" prop="remainingValue">
        <el-input
          v-model="queryParams.remainingValue"
          placeholder="请输入Remaining Value"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <!-- <el-form-item label="采购订单行id" prop="purchaseLineId">
        <el-input
          v-model="queryParams.purchaseLineId"
          placeholder="请输入采购订单行id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="Created Purchase Order Line" prop="createdPurchaseLineId">
        <el-input
          v-model="queryParams.createdPurchaseLineId"
          placeholder="请输入Created Purchase Order Line"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="Repair" prop="repairId">
        <el-input
          v-model="queryParams.repairId"
          placeholder="请输入Repair"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="销售订单行id" prop="saleLineId">
        <el-input
          v-model="queryParams.saleLineId"
          placeholder="请输入销售订单行id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="有效" prop="active">
        <el-input
          v-model="queryParams.active"
          placeholder="请输入有效"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="Shipping Method" prop="shippingMethod">
        <el-input
          v-model="queryParams.shippingMethod"
          placeholder="请输入Shipping Method"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['system:move:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['system:move:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['system:move:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['system:move:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="moveList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <!-- <el-table-column label="${comment}" align="center" prop="id" /> -->

      <!-- <el-table-column label="序列" align="center" prop="sequence" /> -->
      <!-- <el-table-column label="Priority" align="center" prop="priority" /> -->
      <!-- <el-table-column label="创建日期" align="center" prop="createDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column> -->
      <el-table-column label="日期" align="center" prop="date" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="参考" align="center" prop="name" />
      <!-- <el-table-column label="公司id" align="center" prop="companyId" /> -->
      <!-- <el-table-column label="期望日期" align="center" prop="dateExpected" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.dateExpected, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column> -->
      <el-table-column label="产品id" align="center" prop="productId" />
      <el-table-column label="订单数量" align="center" prop="orderedQty" />
      <el-table-column label="库存数量" align="center" prop="productQty" />
      <!-- <el-table-column label="Initial Demand" align="center" prop="productUomQty" /> -->
      <!-- <el-table-column label="单位" align="center" prop="productUom" /> -->
      <!-- <el-table-column label="未知" align="center" prop="productPackaging" /> -->
      <!-- <el-table-column label="位置" align="center" prop="locationId" /> -->
      <!-- <el-table-column label="Destination Location" align="center" prop="locationDestId" /> -->
      <!-- <el-table-column label="合作伙伴id" align="center" prop="partnerId" /> -->
      <!-- <el-table-column label="库存收发id" align="center" prop="pickingId" /> -->
      <!-- <el-table-column label="备注" align="center" prop="note" /> -->
      <el-table-column label="状态" align="center" prop="state" />
      <!-- <el-table-column label="单价" align="center" prop="priceUnit" /> -->
      <!-- <el-table-column label="数据源" align="center" prop="origin" /> -->
      <el-table-column label="Supply Method" align="center" prop="procureMethod" />
      <!-- <el-table-column label="Scrapped" align="center" prop="scrapped" /> -->
      <!-- <el-table-column label="组别" align="center" prop="groupId" /> -->
      <!-- <el-table-column label="规则" align="center" prop="ruleId" /> -->
      <!-- <el-table-column label="Push Rule" align="center" prop="pushRuleId" /> -->
      <!-- <el-table-column label="Propagate cancel and split" align="center" prop="propagate" /> -->
      <!-- <el-table-column label="库存收发类别" align="center" prop="pickingTypeId" /> -->
      <!-- <el-table-column label="Inventory" align="center" prop="inventoryId" /> -->
      <!-- <el-table-column label="Origin return move" align="center" prop="originReturnedMoveId" /> -->
      <!-- <el-table-column label="Owner " align="center" prop="restrictPartnerId" /> -->
      <!-- <el-table-column label="海内外" align="center" prop="warehouseId" /> -->
      <!-- <el-table-column label="Whether the move was added after the picking's confirmation" align="center" prop="additional" /> -->
      <!-- <el-table-column label="Reference" align="center" prop="reference" /> -->
      <!-- <el-table-column label="创建者" align="center" prop="createUid" /> -->
      <!-- <el-table-column label="更新者" align="center" prop="writeUid" /> -->
      <!-- <el-table-column label="更新日期" align="center" prop="writeDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.writeDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column> -->
      <!-- <el-table-column label="Created Production Order" align="center" prop="createdProductionId" /> -->
      <!-- <el-table-column label="Production Order for finished products" align="center" prop="productionId" /> -->
      <!-- <el-table-column label="Production Order for raw materials" align="center" prop="rawMaterialProductionId" /> -->
      <!-- <el-table-column label="Disassembly Order" align="center" prop="unbuildId" /> -->
      <!-- <el-table-column label="Consumed Disassembly Order" align="center" prop="consumeUnbuildId" /> -->
      <!-- <el-table-column label="Operation To Consume" align="center" prop="operationId" /> -->
      <!-- <el-table-column label="工作订单id" align="center" prop="workorderId" /> -->
      <!-- <el-table-column label="订单行id" align="center" prop="bomLineId" /> -->
      <!-- <el-table-column label="Unit Factor" align="center" prop="unitFactor" /> -->
      <!-- <el-table-column label="是否完成" align="center" prop="isDone" /> -->
      <!-- <el-table-column label="To Refund (update SO/PO)" align="center" prop="toRefund" /> -->
      <!-- <el-table-column label="value" align="center" prop="value" /> -->
      <!-- <el-table-column label="Remaining Qty" align="center" prop="remainingQty" /> -->
      <!-- <el-table-column label="Remaining Value" align="center" prop="remainingValue" /> -->
      <!-- <el-table-column label="采购订单行id" align="center" prop="purchaseLineId" /> -->
      <!-- <el-table-column label="Created Purchase Order Line" align="center" prop="createdPurchaseLineId" /> -->
      <!-- <el-table-column label="Repair" align="center" prop="repairId" /> -->
      <!-- <el-table-column label="销售订单行id" align="center" prop="saleLineId" /> -->
      <!-- <el-table-column label="有效" align="center" prop="active" /> -->
      <!-- <el-table-column label="Shipping Method" align="center" prop="shippingMethod" /> -->
      <!-- <el-table-column label="类别" align="center" prop="overseasType" /> -->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">

          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
           >修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
           >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改库存收发对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="参考" prop="name">
          <el-input v-model="form.name" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="序列" prop="sequence">
          <el-input v-model="form.sequence" placeholder="请输入序列" />
        </el-form-item>
        <el-form-item label="Priority" prop="priority">
          <el-input v-model="form.priority" placeholder="请输入Priority" />
        </el-form-item>
        <el-form-item label="创建日期" prop="createDate">
          <el-date-picker clearable v-model="form.createDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择创建日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="日期" prop="date">
          <el-date-picker clearable v-model="form.date" type="date" value-format="yyyy-MM-dd" placeholder="请选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="公司id" prop="companyId">
          <el-input v-model="form.companyId" placeholder="请输入公司id" />
        </el-form-item>
        <el-form-item label="期望日期" prop="dateExpected">
          <el-date-picker clearable v-model="form.dateExpected" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择期望日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="产品id" prop="productId">
          <el-input v-model="form.productId" placeholder="请输入产品id" />
        </el-form-item>
        <el-form-item label="订单数量" prop="orderedQty">
          <el-input v-model="form.orderedQty" placeholder="请输入订单数量" />
        </el-form-item>
        <el-form-item label="库存数量" prop="productQty">
          <el-input v-model="form.productQty" placeholder="请输入库存数量" />
        </el-form-item>
        <el-form-item label="Initial Demand" prop="productUomQty">
          <el-input v-model="form.productUomQty" placeholder="请输入Initial Demand" />
        </el-form-item>
        <el-form-item label="单位" prop="productUom">
          <el-input v-model="form.productUom" placeholder="请输入单位" />
        </el-form-item>
        <el-form-item label="未知" prop="productPackaging">
          <el-input v-model="form.productPackaging" placeholder="请输入未知" />
        </el-form-item>
        <el-form-item label="位置" prop="locationId">
          <el-input v-model="form.locationId" placeholder="请输入位置" />
        </el-form-item>
        <el-form-item label="Destination Location" prop="locationDestId">
          <el-input v-model="form.locationDestId" placeholder="请输入Destination Location" />
        </el-form-item>
        <el-form-item label="合作伙伴id" prop="partnerId">
          <el-input v-model="form.partnerId" placeholder="请输入合作伙伴id" />
        </el-form-item>
        <el-form-item label="库存收发id" prop="pickingId">
          <el-input v-model="form.pickingId" placeholder="请输入库存收发id" />
        </el-form-item>
        <el-form-item label="备注" prop="note">
          <el-input v-model="form.note" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="状态" prop="state">
          <el-input v-model="form.state" placeholder="请输入状态" />
        </el-form-item>
        <el-form-item label="单价" prop="priceUnit">
          <el-input v-model="form.priceUnit" placeholder="请输入单价" />
        </el-form-item>
        <el-form-item label="数据源" prop="origin">
          <el-input v-model="form.origin" placeholder="请输入数据源" />
        </el-form-item>
        <el-form-item label="Supply Method" prop="procureMethod">
          <el-input v-model="form.procureMethod" placeholder="请输入Supply Method" />
        </el-form-item>
        <el-form-item label="Scrapped" prop="scrapped">
          <el-input v-model="form.scrapped" placeholder="请输入Scrapped" />
        </el-form-item>
        <el-form-item label="组别" prop="groupId">
          <el-input v-model="form.groupId" placeholder="请输入组别" />
        </el-form-item>
        <el-form-item label="规则" prop="ruleId">
          <el-input v-model="form.ruleId" placeholder="请输入规则" />
        </el-form-item>
        <el-form-item label="Push Rule" prop="pushRuleId">
          <el-input v-model="form.pushRuleId" placeholder="请输入Push Rule" />
        </el-form-item>
        <el-form-item label="Propagate cancel and split" prop="propagate">
          <el-input v-model="form.propagate" placeholder="请输入Propagate cancel and split" />
        </el-form-item>
        <el-form-item label="库存收发类别" prop="pickingTypeId">
          <el-input v-model="form.pickingTypeId" placeholder="请输入库存收发类别" />
        </el-form-item>
        <el-form-item label="Inventory" prop="inventoryId">
          <el-input v-model="form.inventoryId" placeholder="请输入Inventory" />
        </el-form-item>
        <el-form-item label="Origin return move" prop="originReturnedMoveId">
          <el-input v-model="form.originReturnedMoveId" placeholder="请输入Origin return move" />
        </el-form-item>
        <el-form-item label="Owner " prop="restrictPartnerId">
          <el-input v-model="form.restrictPartnerId" placeholder="请输入Owner " />
        </el-form-item>
        <el-form-item label="海内外" prop="warehouseId">
          <el-input v-model="form.warehouseId" placeholder="请输入海内外" />
        </el-form-item>
        <el-form-item label="Whether the move was added after the picking's confirmation" prop="additional">
          <el-input v-model="form.additional"
            placeholder="请输入Whether the move was added after the picking's confirmation" />
        </el-form-item>
        <el-form-item label="Reference" prop="reference">
          <el-input v-model="form.reference" placeholder="请输入Reference" />
        </el-form-item>
        <el-form-item label="创建者" prop="createUid">
          <el-input v-model="form.createUid" placeholder="请输入创建者" />
        </el-form-item>
        <el-form-item label="更新者" prop="writeUid">
          <el-input v-model="form.writeUid" placeholder="请输入更新者" />
        </el-form-item>
        <el-form-item label="更新日期" prop="writeDate">
          <el-date-picker clearable v-model="form.writeDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择更新日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="Created Production Order" prop="createdProductionId">
          <el-input v-model="form.createdProductionId" placeholder="请输入Created Production Order" />
        </el-form-item>
        <el-form-item label="Production Order for finished products" prop="productionId">
          <el-input v-model="form.productionId" placeholder="请输入Production Order for finished products" />
        </el-form-item>
        <el-form-item label="Production Order for raw materials" prop="rawMaterialProductionId">
          <el-input v-model="form.rawMaterialProductionId" placeholder="请输入Production Order for raw materials" />
        </el-form-item>
        <el-form-item label="Disassembly Order" prop="unbuildId">
          <el-input v-model="form.unbuildId" placeholder="请输入Disassembly Order" />
        </el-form-item>
        <el-form-item label="Consumed Disassembly Order" prop="consumeUnbuildId">
          <el-input v-model="form.consumeUnbuildId" placeholder="请输入Consumed Disassembly Order" />
        </el-form-item>
        <el-form-item label="Operation To Consume" prop="operationId">
          <el-input v-model="form.operationId" placeholder="请输入Operation To Consume" />
        </el-form-item>
        <el-form-item label="工作订单id" prop="workorderId">
          <el-input v-model="form.workorderId" placeholder="请输入工作订单id" />
        </el-form-item>
        <el-form-item label="订单行id" prop="bomLineId">
          <el-input v-model="form.bomLineId" placeholder="请输入订单行id" />
        </el-form-item>
        <el-form-item label="Unit Factor" prop="unitFactor">
          <el-input v-model="form.unitFactor" placeholder="请输入Unit Factor" />
        </el-form-item>
        <el-form-item label="是否完成" prop="isDone">
          <el-input v-model="form.isDone" placeholder="请输入是否完成" />
        </el-form-item>
        <el-form-item label="To Refund (update SO/PO)" prop="toRefund">
          <el-input v-model="form.toRefund" placeholder="请输入To Refund (update SO/PO)" />
        </el-form-item>
        <el-form-item label="value" prop="value">
          <el-input v-model="form.value" placeholder="请输入value" />
        </el-form-item>
        <el-form-item label="Remaining Qty" prop="remainingQty">
          <el-input v-model="form.remainingQty" placeholder="请输入Remaining Qty" />
        </el-form-item>
        <el-form-item label="Remaining Value" prop="remainingValue">
          <el-input v-model="form.remainingValue" placeholder="请输入Remaining Value" />
        </el-form-item>
        <el-form-item label="采购订单行id" prop="purchaseLineId">
          <el-input v-model="form.purchaseLineId" placeholder="请输入采购订单行id" />
        </el-form-item>
        <el-form-item label="Created Purchase Order Line" prop="createdPurchaseLineId">
          <el-input v-model="form.createdPurchaseLineId" placeholder="请输入Created Purchase Order Line" />
        </el-form-item>
        <el-form-item label="Repair" prop="repairId">
          <el-input v-model="form.repairId" placeholder="请输入Repair" />
        </el-form-item>
        <el-form-item label="销售订单行id" prop="saleLineId">
          <el-input v-model="form.saleLineId" placeholder="请输入销售订单行id" />
        </el-form-item>
        <el-form-item label="有效" prop="active">
          <el-input v-model="form.active" placeholder="请输入有效" />
        </el-form-item>
        <el-form-item label="Shipping Method" prop="shippingMethod">
          <el-input v-model="form.shippingMethod" placeholder="请输入Shipping Method" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listMove, getMove, delMove, addMove, updateMove } from "@/api/system/move";

export default {
  name: "Move",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 库存收发表格数据
      moveList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 类别时间范围
      daterangeCreateDate: [],
      // 类别时间范围
      daterangeDate: [],
      // 类别时间范围
      daterangeDateExpected: [],
      // 类别时间范围
      daterangeWriteDate: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        sequence: null,
        priority: null,
        createDate: null,
        date: null,
        companyId: null,
        dateExpected: null,
        productId: null,
        orderedQty: null,
        productQty: null,
        productUomQty: null,
        productUom: null,
        productPackaging: null,
        locationId: null,
        locationDestId: null,
        partnerId: null,
        pickingId: null,
        note: null,
        state: null,
        priceUnit: null,
        origin: null,
        procureMethod: null,
        scrapped: null,
        groupId: null,
        ruleId: null,
        pushRuleId: null,
        propagate: null,
        pickingTypeId: null,
        inventoryId: null,
        originReturnedMoveId: null,
        restrictPartnerId: null,
        warehouseId: null,
        additional: null,
        reference: null,
        createUid: null,
        writeUid: null,
        writeDate: null,
        createdProductionId: null,
        productionId: null,
        rawMaterialProductionId: null,
        unbuildId: null,
        consumeUnbuildId: null,
        operationId: null,
        workorderId: null,
        bomLineId: null,
        unitFactor: null,
        isDone: null,
        toRefund: null,
        value: null,
        remainingQty: null,
        remainingValue: null,
        purchaseLineId: null,
        createdPurchaseLineId: null,
        repairId: null,
        saleLineId: null,
        active: null,
        shippingMethod: null,
        overseasType: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        name: [
          { required: true, message: "参考不能为空", trigger: "blur" }
        ],
        date: [
          { required: true, message: "日期不能为空", trigger: "blur" }
        ],
        companyId: [
          { required: true, message: "公司id不能为空", trigger: "blur" }
        ],
        dateExpected: [
          { required: true, message: "期望日期不能为空", trigger: "blur" }
        ],
        productId: [
          { required: true, message: "产品id不能为空", trigger: "blur" }
        ],
        productUomQty: [
          { required: true, message: "Initial Demand不能为空", trigger: "blur" }
        ],
        productUom: [
          { required: true, message: "单位不能为空", trigger: "blur" }
        ],
        locationId: [
          { required: true, message: "位置不能为空", trigger: "blur" }
        ],
        locationDestId: [
          { required: true, message: "Destination Location不能为空", trigger: "blur" }
        ],
        procureMethod: [
          { required: true, message: "Supply Method不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {

    /** 查询库存收发列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeCreateDate && '' != this.daterangeCreateDate) {
        this.queryParams.params["beginCreateDate"] = this.daterangeCreateDate[0];
        this.queryParams.params["endCreateDate"] = this.daterangeCreateDate[1];
      }
      if (null != this.daterangeDate && '' != this.daterangeDate) {
        this.queryParams.params["beginDate"] = this.daterangeDate[0];
        this.queryParams.params["endDate"] = this.daterangeDate[1];
      }
      if (null != this.daterangeDateExpected && '' != this.daterangeDateExpected) {
        this.queryParams.params["beginDateExpected"] = this.daterangeDateExpected[0];
        this.queryParams.params["endDateExpected"] = this.daterangeDateExpected[1];
      }
      if (null != this.daterangeWriteDate && '' != this.daterangeWriteDate) {
        this.queryParams.params["beginWriteDate"] = this.daterangeWriteDate[0];
        this.queryParams.params["endWriteDate"] = this.daterangeWriteDate[1];
      }
      listMove(this.queryParams).then(response => {
        // console.log(response);
        this.moveList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        name: null,
        sequence: null,
        priority: null,
        createDate: null,
        date: null,
        companyId: null,
        dateExpected: null,
        productId: null,
        orderedQty: null,
        productQty: null,
        productUomQty: null,
        productUom: null,
        productPackaging: null,
        locationId: null,
        locationDestId: null,
        partnerId: null,
        pickingId: null,
        note: null,
        state: null,
        priceUnit: null,
        origin: null,
        procureMethod: null,
        scrapped: null,
        groupId: null,
        ruleId: null,
        pushRuleId: null,
        propagate: null,
        pickingTypeId: null,
        inventoryId: null,
        originReturnedMoveId: null,
        restrictPartnerId: null,
        warehouseId: null,
        additional: null,
        reference: null,
        createUid: null,
        writeUid: null,
        writeDate: null,
        createdProductionId: null,
        productionId: null,
        rawMaterialProductionId: null,
        unbuildId: null,
        consumeUnbuildId: null,
        operationId: null,
        workorderId: null,
        bomLineId: null,
        unitFactor: null,
        isDone: null,
        toRefund: null,
        value: null,
        remainingQty: null,
        remainingValue: null,
        purchaseLineId: null,
        createdPurchaseLineId: null,
        repairId: null,
        saleLineId: null,
        active: null,
        shippingMethod: null,
        overseasType: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeCreateDate = [];
      this.daterangeDate = [];
      this.daterangeDateExpected = [];
      this.daterangeWriteDate = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加库存收发";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getMove(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改库存收发";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateMove(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addMove(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除库存收发编号为"' + ids + '"的数据项？').then(function () {
        return delMove(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/move/export', {
        ...this.queryParams
      }, `move_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
